<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>

	<head>
		<title>Spring MVC Starter Application</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="<c:url value="/static/resources/css/screen.css"/>"/>
	</head>

	<body>
		<div id="container">
			<div id="content">
				<h1>Welcome to All Rap News!</h1>

				<c:choose>
					<c:when test="${topics.size()==0}">
						<em>No topic to read</em>
					</c:when>
					<c:otherwise>
						<em>${topics.size()} topics to read !</em>
						<ul>
							<c:forEach items="${genres}" var="genre">
								<li><a href="${genre.url}">[${genre.label}]</a></li>
							</c:forEach>
						</ul>
						<c:forEach items="${topics}" var="topic">
							<fmt:formatDate value="${topic.publishedDate}" pattern="dd/MM/yyyy HH:mm:ss" /> - ${topic.genre.label} - <a target="_blank" href="${topic.link}">${topic.title}</a> [<a target="_blank" href="${topic.source.url}">${topic.source.label}</a>]<br />
						</c:forEach>
					</c:otherwise>
				</c:choose>
			</div>
			<div id="footer">
			    <p>
					Raskal Foundation<br />
			    </p>
			</div>
		</div>
	</body>
</html>
